"""
聊天记录数据模式
"""
from marshmallow import Schema, fields

class ChatRecordOutSchema(Schema):
    """聊天记录输出模式"""
    id = fields.Integer()
    session_id = fields.Str()
    user_id = fields.Integer(allow_none=True)
    user_name = fields.Str(allow_none=True)
    user_phone = fields.Str(allow_none=True)
    message_type = fields.Str()
    content = fields.Str()
    sender_type = fields.Str()
    ip_address = fields.Str(allow_none=True)
    user_agent = fields.Str(allow_none=True)
    status = fields.Str()
    create_time = fields.DateTime(format='%Y-%m-%d %H:%M:%S')
    update_time = fields.DateTime(format='%Y-%m-%d %H:%M:%S')

class ChatSessionOutSchema(Schema):
    """聊天会话输出模式"""
    id = fields.Integer()
    session_id = fields.Str()
    user_id = fields.Integer(allow_none=True)
    user_name = fields.Str(allow_none=True)
    user_phone = fields.Str(allow_none=True)
    ip_address = fields.Str(allow_none=True)
    user_agent = fields.Str(allow_none=True)
    status = fields.Str()
    start_time = fields.DateTime(format='%Y-%m-%d %H:%M:%S')
    end_time = fields.DateTime(format='%Y-%m-%d %H:%M:%S', allow_none=True)
    message_count = fields.Integer()
    create_time = fields.DateTime(format='%Y-%m-%d %H:%M:%S')
    update_time = fields.DateTime(format='%Y-%m-%d %H:%M:%S') 